public class Stack {
    public LinkNode stackTop;
    public LinkNode stackBottom;
    public Stack(){}
    public Stack(LinkNode stackTop,LinkNode stackBottom){
        this.stackTop=stackTop;
        this.stackBottom=stackBottom;
    }
    /**
     * 进栈
     */
    public static void pushStack(Stack stack,int value){
        LinkNode node1=new LinkNode(value);
        node1.next= stack.stackTop;
        stack.stackTop=node1;
    }

    /**
     * 出栈
     */
    public static void popStack(Stack stack){
        LinkNode temp = stack.stackTop;
        stack.stackTop=temp.next;
        temp=null;
    }
    /**
     * 全栈遍历
     */
    public static void treaveStack(Stack stack){
        LinkNode temp=stack.stackTop;
        while(temp!=stack.stackBottom){
            System.out.println(temp.data);
            temp=temp.next;
        }
    }

    /**
     * 判断栈是否为空
     */
    public static Boolean isEmpty(Stack stack){
        if (stack.stackTop!= stack.stackBottom){
            return false;
        }
        else{
            return true;
        }
    }

    /**
     * 清空栈
     */
    public static void clearStack(Stack stack){
        stack.stackTop=null;
        stack.stackBottom=stack.stackTop;
    }


}
